﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Hxsoft.AppV1.Module;

namespace Hxsoft.AppV1.Admin.CommentManage.Controls
{
	public partial class Comment : BaseUserControl
	{
		#region 成员属性
		/// <summary>
		/// 属性 IsEffective
		/// </summary>
		public bool IsEffective
		{
			get
			{
				return Convert.ToBoolean(CtrlIsEffective.Text);
			}
			set
			{
				CtrlIsEffective.Text = value.ToString();
			}
		}

		/// <summary>
		/// 属性 Content
		/// </summary>
		public string Content
		{
			get
			{
				return Convert.ToString(CtrlContent.Text);
			}
			set
			{
				CtrlContent.Text = value.ToString();
			}
		}

		/// <summary>
		/// 属性 Quote
		/// </summary>
		public string Quote
		{
			get
			{
				if (String.IsNullOrEmpty(CtrlQuote.Text))
					return null;

				return Convert.ToString(CtrlQuote.Text);
			}
			set
			{
				if (value == null)
					CtrlQuote.Text = "";
				else
					CtrlQuote.Text = value.ToString();
			}
		}


		/// <summary>
		/// 控件的 CommentInfo 实例。
		/// </summary>
		public Module.Comment Info
		{
			get
			{
				Module.Comment comment = new Module.Comment();

				comment.IsEffective = IsEffective;
				comment.Content = Content;
				comment.Quote = Quote;

				return comment;
			}
			set
			{
				if (value == null) return;

				IsEffective = value.IsEffective;
				Content = value.Content;
				Quote = value.Quote;
			}
		}
		#endregion

		#region 成员函数
		#endregion

		protected void Page_Load(object sender, EventArgs e)
		{
			if (!IsPostBack)
				this.DataBind();
		}
	}
}